package cate.game.role.pvp.eliterace.msg;

import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.pvp.eliterace.data.EliteRaceSpec;
import easy.java.practice.errorcode.EcResult;

import static cate.game.client.msg.MsgSender.send;
import static cate.game.client.msg.id.MsgIdBEliteRace.GROUP_ROUND_REQ;

@ClientMsg(title = "精英赛 组回合 请求")
public class EliteRaceGroupRoundReq implements MsgInput {

    public long tag;
    public EliteRaceSpec from;
    public EliteRaceSpec to;

    @Override
    public MsgConfig conf() {
        return GROUP_ROUND_REQ;
    }

    @Override
    public void execute(GameBody game, ClientContext cc) {
        EcResult<EliteRaceGroupRoundResp> r
                = game.pvp.eliteRace.getHandler().handleGroupRoundReq(this);
        if (r.ok()) {
            send(cc::sendNow, r.data);
        }
    }
}
